-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[DRAFT] Feature/files changed overview #5400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DRAFT] Feature/files changed overview #5400
Conversation
This commit introduces the 'Files Changed Overview' feature, providing users with a UI to see and manage file modifications made by the agent. Key changes include: - A new UI component in the webview to list modified files. - Granular checkpointing and file-change tracking with a new `FileChangeManager`. - Updates to backend services and tools to support file-change tracking. - New message types for communication between the extension and the webview. # Overview of Changes for the "Files Changed Overview" Feature This document provides a comprehensive overview of the changes made to implement the "Files Changed Overview" feature in Roo Code. This feature provides users with a clear and concise view of the files that have been modified by the AI agent, allowing them to easily review, accept, or reject the changes. ## High-Level Summary The "Files Changed Overview" feature introduces a new UI component in the webview that lists all the files that have been modified by the AI agent. For each file, the user can see the type of change (create, edit, or delete), the number of lines added and removed, and buttons to view the diff, accept the change, or reject the change. The user can also accept or reject all changes at once. To support this feature, significant changes have been made to the backend and frontend of the application. The backend changes include a new checkpointing system, a new file change tracking system, and modifications to the existing tools and services to support the new feature. The frontend changes include a new UI component for displaying the file changes, as well as updates to the existing components and context to support the new feature. ## Backend Changes The backend changes are the most significant part of this update. They provide the core functionality for the "Files Changed Overview" feature. ### New Services and Managers - **`FileChangeManager`:** This new class is the heart of the file change tracking system. It's responsible for recording, managing, and persisting file changes. - **`DiffManager`:** This new class provides a simple and reusable way to get the diff from the checkpoint service. - **`RepoPerTaskCheckpointService`:** This new class extends the `ShadowCheckpointService` and provides a checkpointing service that is specific to each task. ### Modifications to Existing Files - **`ShadowCheckpointService`:** This class has been heavily refactored to improve the checkpointing process and provide the necessary functionality for the "Files Changed Overview" feature. - **`Task`:** The `Task` class has been updated to integrate the `FileChangeManager` and the `RepoPerTaskCheckpointService`. - **`ClineProvider`:** The `ClineProvider` class has been extensively modified to serve as the central hub for communication between the webview and the extension for the "Files Changed Overview" feature. - **Tools:** The `applyDiffTool`, `insertContentTool`, `searchAndReplaceTool`, and `writeToFileTool` have all been updated to support the new feature. ## Frontend Changes The frontend changes provide the UI for the "Files Changed Overview" feature. ### New Components - **`FilesChangedOverview`:** This new component is the UI for the "Files Changed Overview" feature. It displays a list of the files that have been changed and provides buttons for the user to interact with them. ### Modifications to Existing Files - **`ChatView`:** The `ChatView` component has been updated to render the `FilesChangedOverview` component and handle the communication with the extension. - **`ExtensionStateContext`:** The `ExtensionStateContextProvider` has been updated to manage the state of the file changes. ## Types and Communication Protocols The types and communication protocols have been updated to support the new feature. - **`file-changes.ts`:** This new file defines the core data structures for tracking file changes. - **`ExtensionMessage.ts`:** The `ExtensionMessage` interface has been updated to include new types and properties for the "Files Changed Overview" feature. - **`WebviewMessage.ts`:** The `WebviewMessage` interface has been updated to include new types and properties for the "Files Changed Overview" feature. ## Conclusion The "Files Changed Overview" feature is a major new addition to Roo Code that will significantly improve the user experience. The changes made to implement this feature are extensive and touch on many different parts of the application. However, they provide a solid foundation for future development and will help to make Roo Code a more powerful and user-friendly tool.
- Fix ShadowCheckpointService to use workspace root with GIT_DIR for proper git operations - Convert FileChangeManager methods to async to prevent race conditions in persistence - Update ClineProvider to properly await FileChangeManager async operations - Fix UI button styling to use VSCode theme variables instead of hardcoded colors These changes resolve critical issues with the FilesChangedOverview feature including git operations, async handling, and theme consistency. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
…w persistence and race conditions Applied critical fixes documented in /Users/shaaheenpeyvan/Documents/Projects/Roo/Docs/retry/FIXES.md: - FileChangeManager: Added race condition prevention mechanism with persistenceInProgress and pendingPersistence flags - FileChangeManager: Implemented atomic file writing using temporary files and rename operations - FileChangeManager: Enhanced async persistence with proper error handling and sequential operation management - ShadowCheckpointService: Already had correct workspace root + GIT_DIR configuration fix applied - ClineProvider: Already properly awaited async FileChangeManager calls - FilesChangedOverview: Already using correct VSCode theme variables for button styling All fixes ensure FilesChangedOverview feature works reliably with: - Proper async/await patterns preventing race conditions - Atomic persistence operations preventing data corruption - Correct shadow git configuration for workspace-wide file tracking - Theme-consistent UI styling matching VSCode appearance 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Successfully merged main branch into feature/files-changed-overview while preserving all critical FilesChangedOverview functionality and fixes: ## Preserved Critical Features: - FileChangeManager async persistence with race condition prevention - ShadowCheckpointService workspace root + GIT_DIR configuration - ClineProvider async/await patterns for file operations - FilesChangedOverview UI with VSCode theme integration ## Resolved Merge Conflicts: - Updated ShadowCheckpointService with new nested git detection methods - Fixed executeRipgrep import to use correct service path - Integrated marketplace manager parameter in ClineProvider - Updated extension.ts with mdmService parameter - Regenerated pnpm-lock.yaml after dependency conflicts - Merged webview-ui package.json dependencies ## Build Verification: - ✅ TypeScript compilation passing - ✅ Full build sequence successful - ✅ VSIX generation working (roo-cline-3.22.4.vsix) - ✅ All critical async patterns preserved - ✅ FilesChangedOverview feature remains functional The merge maintains backward compatibility while integrating latest main branch improvements and new features. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Fixed hasNestedGitRepositories to properly exclude root .git directory
while detecting actual nested repositories.
## Problem:
The previous filter logic incorrectly flagged "Roo-Code/.git" as a nested
repository, causing checkpoint initialization to fail with:
"Checkpoints are disabled because nested git repositories were detected"
## Root Cause:
Filter condition `\!path.startsWith(".git") && path \!== ".git"` was too
simplistic and didn't account for project-name/.git patterns.
## Solution:
Updated filter logic to:
- Explicitly exclude paths ending with "/.git" (root repository patterns)
- Exclude exact ".git" matches
- Only flag actual nested repositories (e.g., "submodule/.git", "nested/project/.git")
## Impact:
- ✅ Checkpoints now initialize correctly in normal git repositories
- ✅ Still properly detects and blocks actual nested git repositories
- ✅ FilesChangedOverview feature can now function with checkpoint support
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
The .roo directory approach was specifically designed to eliminate the need for nested git repository detection. Removed the hasNestedGitRepositories check entirely from initShadowGit. ## Why This Fix Was Needed: The shadow git system uses a separate .roo/.git directory that operates independently of any existing git repositories. The nested git detection was a legacy requirement that no longer applies. ## Changes: - Removed hasNestedGitRepositories() method and its call - Removed executeRipgrep import (no longer needed) - Simplified initShadowGit to go straight to shadow repo creation ## Impact: - ✅ Checkpoints now work in any workspace regardless of git structure - ✅ FilesChangedOverview feature can initialize properly - ✅ No more false positives blocking checkpoint functionality - ✅ Maintains the isolation benefits of .roo directory approach The shadow git system in .roo is completely isolated and doesn't interfere with workspace git repositories, making nested detection unnecessary. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Fixed critical persistence issue where rejected files would reappear in FilesChangedOverview after new files were edited. The problem was in FileChangeManager.recordChange() method which only persisted new file changes but not updates to existing file changes. Key changes: - Move persistChanges() call outside the if/else block in recordChange() - Now persists both new file changes AND updates to existing file changes - Prevents rejected files from reappearing due to incomplete persistence - Ensures atomic file writes prevent race conditions This resolves the issue where: 1. User rejects files from FilesChangedOverview 2. User edits new files 3. Previously rejected files reappear in the overview 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Reorganized FilesChangedOverview and BatchDiffApproval components from webview-ui/src/components/chat/ to webview-ui/src/components/file-changes/ This follows the established project pattern of organizing components by functional domain rather than mixing unrelated features in chat/. Changes: - Move FilesChangedOverview.tsx to components/file-changes/ - Move BatchDiffApproval.tsx to components/file-changes/ - Create index.ts for cleaner imports - Update import paths in ChatView.tsx and ChatRow.tsx Benefits: - Clear separation of concerns - Better maintainability and discoverability - Consistent with patterns used for marketplace/, mcp/, settings/ etc. - Allows for future expansion of file change functionality 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
…saves - Move FileChangeManager creation from 'checkpointCreated' to 'initialize' event - Ensures FileChangeManager exists before baseline update attempts in resumed tasks - Add deduplication logic to prevent multiple simultaneous checkpoint saves - Add debug logging for checkpoint detection issues - Files modified after last checkpoint are now properly tracked in FilesChangedOverview Fixes the invisible file changes issue where files created/modified after the last checkpoint but before FileChangeManager initialization were not being tracked. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Added settings to enable filesChangedManager and display count.
Removed the virtualization settings for FilesChangedOverview
Added handlers for FilesChangedEnabled so settings work properly.
Resolved merge conflicts: - Preserved FilesChangedOverview feature integration in ClineProvider.ts - Maintained file change message types in WebviewMessage.ts - Kept filesChangedEnabled setting in SettingsView.tsx and global-settings.ts - Accepted main's version for all README.md translation files - Integrated new followup questions feature from main branch 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
| }).not.toThrow() | ||
|
|
||
| expect(() => { | ||
| fireEvent.click(screen.getByTestId("diff-error-test.ts")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test is attempting to get an element by test ID 'diff-error-test.ts', but other tests use the prefix 'file-item-'. This may be a typo. Ensure that the correct test ID is used consistently.
| fireEvent.click(screen.getByTestId("diff-error-test.ts")) | |
| fireEvent.click(screen.getByTestId("file-item-error-test.ts")) |
| "header": { | ||
| "files_changed": "File yang Diubah", | ||
| "expand": "Perluas daftar file", | ||
| "collapse": "Ciutkan daftar file" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typographical inconsistency: The header value for "collapse" is "Ciutkan daftar file", while the accessibility section uses "Diciutkan" for the corresponding state. Consider using a consistent term (e.g., "Diciutkan daftar file") to avoid confusion.
| "collapse": "Ciutkan daftar file" | |
| "collapse": "Diciutkan daftar file" |
This comment was generated because it violated a code review rule: irule_C0ez7Rji6ANcGkkX.
|
Hey @playcations, I noticed that there are a lot of unrelated changes in this PR. It would be great to clean it up so it only includes the relevant changes related to the actual fix or feature. This will make the review process much easier and help ensure we stay focused on the core update. Let me know if you have any questions! |
|
@daniel-lxs I'll take another pass on it. When it comes to Accessibility features, I noticed a lot of bots happening right now, Should I be dealing with those like I am now or would you prefer I remove those as well? |
|
You mean bugs? what kind of bugs are you seeing regarding accessibility? |
|
no, if there are bugs that is all on me. I'll look into things when I get more free time. I was more talking about ellipsis-dev correcting grammar and such. I will get that functioning now that I have a better idea of what to do next with this PR. ty. |
|
Cool proof of concept. Roll it back into the issue so we can review the issue internally and get it approved. Ultimately the issue should include breakdown by PR so they can be reviewed somewhat separately. If you are unable to break it down this way we can do it internally and likely also implement it. This looks really good overall. |
Related GitHub Issue
Closes: # 4454
Roo Code Task Context (Optional)
Description
This adds a window in chat to show files that have been modified by agents.
Features include accepting changes, diffing and rejecting changes outright.
This prevents you from needing to keep git open or going back to a previous checkpoint after every big modifications to the codebase. I definitely had times where some good changes have happened but then the agent decides theya ren't done! You can easily reject some of the changes instead of all of them. If you don't like this feature, you can also turn it off in the settings menu.
Checkpoints system did need modifications to get this to work properly. You can see what was done there and let me know what you think.
ShadowCheckpoints are now stored in a .roo folder in root. this prevents the need to search for all git files and turn off the system if some are found not in root. This was a real bummer when I went to use roo on larger codebases that have .gits throughout.
Test Procedure
open chat and ask it to modify some files, make new files, etc. accept or reject the changes
open settings menu and under interfaces, turn off the feature, go through the steps again
turn on the feature on last time and go through the steps again.
make sure checkpoints still work.
Pre-Submission Checklist
Screenshots / Videos
Documentation Updates
You can add a line like, "After every checkpoint, Files changed will appear in chat. You have the option to accept or reject them on a file by file basis. to turn this feature off, find it in the settings menu" but I dn't think it makes much to consider it significant.
Additional Notes
This is a draft, If there are issues, let me know and I will work on them.
Get in Touch
discord: playcations
Important
Adds a feature to display and manage file changes in chat, with settings integration and comprehensive testing.
FilesChangedOverviewcomponent to display file changes in chat.InterfaceSettings.tsx).InternationalizationSupport.spec.tsx).WebviewMessageFlow.integration.spec.tsx).VirtualizationPerformance.spec.tsx).ExtensionStateContext.tsxto manage file changes state.SettingsView.tsxto include interface settings for file changes.This description was created by
for afaf431. You can customize this summary. It will automatically update as commits are pushed.